<html>
<head><meta charset="utf-8"><title>Method for `&amp;[Box&lt;T&gt;]` -&gt; `&amp;[&amp;T]` · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Method.20for.20.60.26.5BBox.3CT.3E.5D.60.20-.3E.20.60.26.5B.26T.5D.60.html">Method for `&amp;[Box&lt;T&gt;]` -&gt; `&amp;[&amp;T]`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="207593042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Method%20for%20%60%26%5BBox%3CT%3E%5D%60%20-%3E%20%60%26%5B%26T%5D%60/near/207593042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> isHavvy <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Method.20for.20.60.26.5BBox.3CT.3E.5D.60.20-.3E.20.60.26.5B.26T.5D.60.html#207593042">(Aug 21 2020 at 01:26)</a>:</h4>
<p>I'm writing some code where I have to pass owned data over a thread, so <code>Vec&lt;Box&lt;T&gt;&gt;</code>, but the method I want to call wants a <code>&amp;[&amp;T]</code>. I can go from <code>Vec&lt;Box&lt;T&gt;&gt;</code> to <code>&amp;[Box&lt;T&gt;]</code>, but I can't replace the inner <code>Box</code> with an <code>&amp;</code> without copying or going through iterators. Given that <code>Box</code> and <code>&amp;</code> have the same type layout, I'd like to propose adding a method to do this to the stdlib. Thoughts?</p>



<a name="207595525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Method%20for%20%60%26%5BBox%3CT%3E%5D%60%20-%3E%20%60%26%5B%26T%5D%60/near/207595525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Method.20for.20.60.26.5BBox.3CT.3E.5D.60.20-.3E.20.60.26.5B.26T.5D.60.html#207595525">(Aug 21 2020 at 02:32)</a>:</h4>
<p>this can certainly be done with <code>from_raw_parts</code></p>



<a name="207595541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Method%20for%20%60%26%5BBox%3CT%3E%5D%60%20-%3E%20%60%26%5B%26T%5D%60/near/207595541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Method.20for.20.60.26.5BBox.3CT.3E.5D.60.20-.3E.20.60.26.5B.26T.5D.60.html#207595541">(Aug 21 2020 at 02:33)</a>:</h4>
<p>I think this will become part of the standard library "automatically" as soon as the safe transmute stuff happens.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>